Revert 20338:5f28661bb2bb
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 19 Oct 2009 12:03:03 +0000 (13:03 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 19 Oct 2009 12:03:03 +0000 (13:03 +0100)
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
xen/drivers/passthrough/iommu.c
xen/drivers/passthrough/vtd/intremap.c
xen/drivers/passthrough/vtd/iommu.c

index 9f5c40f5e0f50ba5c3ca7be9729d2c5c4103566e..b1ce67f7415a4e0c9b6975fe5a80b4171c4a19d4 100644 (file)
@@ -266,13 +266,9 @@ int iommu_setup(void)
 {
     int rc = -ENODEV;
 
-    if ( acpi_disabled )
-        iommu_enabled = 0;
-    else
-    {
-        rc = iommu_hardware_setup();
-        iommu_enabled = (rc == 0);
-    }
+    rc = iommu_hardware_setup();
+
+    iommu_enabled = (rc == 0);
 
     if ( force_iommu && !iommu_enabled )
         panic("IOMMU setup failed, crash Xen for security purpose!\n");
index bad38ff7d3acb5ff16976076a725adbadec313e0..595afbaa1e50689661f49bafb8108d993ba6c603 100644 (file)
@@ -575,7 +575,8 @@ void msi_msg_read_remap_rte(
     struct iommu *iommu = NULL;
     struct ir_ctrl *ir_ctrl;
 
-    drhd = acpi_find_matched_drhd_unit(pdev);
+    if ( (drhd = acpi_find_matched_drhd_unit(pdev)) == NULL )
+        return;
     iommu = drhd->iommu;
 
     ir_ctrl = iommu_ir_ctrl(iommu);
@@ -593,7 +594,8 @@ void msi_msg_write_remap_rte(
     struct iommu *iommu = NULL;
     struct ir_ctrl *ir_ctrl;
 
-    drhd = acpi_find_matched_drhd_unit(pdev);
+    if ( (drhd = acpi_find_matched_drhd_unit(pdev)) == NULL )
+        return;
     iommu = drhd->iommu;
 
     ir_ctrl = iommu_ir_ctrl(iommu);
index 5cc69e98c75912c38122e44dcc8b8165e8f90c43..af611a9d40c076278ccfd39e2ff69790af318590 100644 (file)
@@ -1349,7 +1349,8 @@ static int reassign_device_ownership(
     if (!pdev)
         return -ENODEV;
 
-    drhd = acpi_find_matched_drhd_unit(pdev);
+    if ( (drhd = acpi_find_matched_drhd_unit(pdev)) == NULL )
+        return -ENODEV;
     pdev_iommu = drhd->iommu;
     domain_context_unmap(source, bus, devfn);
 
@@ -1363,7 +1364,7 @@ static int reassign_device_ownership(
     for_each_pdev ( source, pdev )
     {
         drhd = acpi_find_matched_drhd_unit(pdev);
-        if ( drhd->iommu == pdev_iommu )
+        if ( drhd && drhd->iommu == pdev_iommu )
         {
             found = 1;
             break;